/**
 * @Title: MqPrarmsVo.java
 * @Package cn.com.ytst.data.integration.vo
 * @Description: TODO(用一句话描述该文件做什么)
 * @author 123774135@qq.com
 * @date 2019年2月15日 下午1:42:58
 * @version V1.0
 */
package cn.com.ytst.data.integration.components.writer.kafka;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.alibaba.datax.common.util.Configuration;
import com.ytst.framework.common.tools.JsonUtil;

import cn.com.ytst.data.integration.util.Constants;

/**
 * @author 123774135@qq.com
 * @ClassName: MqPrarmsVo
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019年2月15日 下午1:42:58
 */
public class MqPrarmsVo implements java.io.Serializable {

	/**
	 * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
	 */
	private static final long serialVersionUID = -8701428433316812189L;

	private String username;
	private String password;
	private String host;
	private String port;
	private String queue;
	private String topic;
	private String key;
	private String schema;
	private boolean encrypt;
	private String sysName;
	private String tableName;
	private String airport;
	private boolean isBatch;
	private int pageSize;
	public String extractTime;
	private String filename;
	private Configuration configuration;

	public MqPrarmsVo() {

	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public MqPrarmsVo(String username, String password, String host, String port, String queue, String topic,
			String key, String schema, String sysName, String tableName, String airport, boolean isBatch, int pageSize,
			String extractTime, Configuration configuration) {
		this.host = host;
		this.username = username;
		this.password = password;
		this.port = port;
		this.queue = queue;
		this.topic = topic;
		this.key = key;
		this.schema = schema;
		this.tableName = tableName;
		this.airport = airport;
		this.isBatch = isBatch;
		this.pageSize = pageSize;
		this.extractTime = extractTime;
		this.sysName = sysName;
		this.configuration = configuration;
	}

	public MqPrarmsVo(Configuration configuration) {
		this.configuration = configuration;
		this.host = configuration.getString(Constants.MQ_HOST_TAG);
        //用户名或者密码有可能存在加密
		this.username = configuration.getString(Constants.MQ_USERNAME_TAG);
		this.password = configuration.getString(Constants.MQ_PWD_TAG);
		this.port = configuration.getString(Constants.MQ_PORT_TAG);
		this.encrypt = configuration.getBool(Constants.MQ_ENCRYPT_TAG);
		this.queue = configuration.getString(Constants.MQ_QUEUE_TAG);
		this.topic = configuration.getString(Constants.TOPIC_TAG);
		this.key = configuration.getString(Constants.KEY_TAG);
		this.schema = configuration.getString(Constants.MQ_SCHEMA);
        //String type = configuration.getString(Constants.MQ_TYPE_TAG);//消息中间件类型
		this.sysName = configuration.getString(Constants.MQ_SYSNAME);
		this.tableName = configuration.getString(Constants.MQ_TABLE_NAME);
		this.airport = configuration.getString(Constants.MQ_AIRPORT);
		this.isBatch = configuration.getBool(Constants.MQ_IS_BATCH,true);
		this.pageSize = configuration.getInt(Constants.MQ_PAGESIZE,100);
        SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
		this.extractTime = sf.format(new Date());
		this.encrypt = configuration.getBool(Constants.MQ_ENCRYPT_TAG);
	}

	public boolean getEncrypt() {
		return encrypt;
	}

	public Configuration getConfiguration() {
		return configuration;
	}

	public void setConfiguration(Configuration configuration) {
		this.configuration = configuration;
	}

	public void setEncrypt(boolean encrypt) {
		this.encrypt = encrypt;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public String getQueue() {
		return queue;
	}

	public void setQueue(String queue) {
		this.queue = queue;
	}

	public String getTopic() {
		return topic;
	}

	public void setTopic(String topic) {
		this.topic = topic;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getSchema() {
		return schema;
	}

	public void setSchema(String schema) {
		this.schema = schema;
	}

	public boolean isEncrypt() {
		return encrypt;
	}

	public String getSysName() {
		return sysName;
	}

	public void setSysName(String sysName) {
		this.sysName = sysName;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getAirport() {
		return airport;
	}

	public void setAirport(String airport) {
		this.airport = airport;
	}

	public boolean getIsBatch() {
		return isBatch;
	}

	public void setIsBatch(boolean isBatch) {
		this.isBatch = isBatch;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getExtractTime() {
		return extractTime;
	}

	public void setExtractTime(String extractTime) {
		this.extractTime = extractTime;
	}

	public void setBatch(boolean isBatch) {
		this.isBatch = isBatch;
	}

	// @Override
	// public String toString() {
	// return JsonUtil.objectToJson(this);
	// }

}
